package com.zp.self.module.qualifier.controller;

import com.zp.self.module.qualifier.annotation.MyService;
import com.zp.self.module.qualifier.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author By ZengPeng
 * @Description
 * @date in  2021/1/11 11:01
 * @Modified By
 */
@RestController
@RequestMapping("/mytest")
public class MyTestController {

    @MyService
    @Autowired(required = false)
    private List<SystemService> systemService;

    @Resource
    Environment environment;

    @RequestMapping(value = "/hi",method = RequestMethod.GET)
    public Object hi(){
        return systemService;
    }

    @RequestMapping(value = "/getEnvironment",method = RequestMethod.GET)
    public Object getEnvironment(){
        System.out.println(environment.getProperty("clod-fish22.name"));
        System.out.println(environment.getProperty("spring.application.name"));
        return environment.getProperty("clod-fish22.name");
    }
}
